#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
using namespace std;
class Person
{
public:
	Person(string name, int score)
	{
		this->name = name;
		this->score = score;
	}
	~Person(){};
	string name;
	int score;
};
void print(vector<Person> & v)
{
	for (vector<Person>::iterator i = v.begin(); i != v.end(); ++i)
	{
		cout<<(*i).name<<": \t"<<(*i).score<<"\t"<<endl;
	}cout<<endl;
}
void createPerson(vector<Person> &vp)
{
	/*
	string nameSeed = "ABCDE";
	int score = 0;
	for (int i = 0; i < 5; ++i)
	{
		string name = "competitor_";
		name += nameSeed[i];
		Person p(name, score);
		vp.push_back(p);
	}
	*/
	int score;
	Person p1("Loren", score);
	Person p2("Evan", score);
	Person p3("Vicky", score);
	Person p4("Larry", score);
	Person p5("Tess", score);
	Person p6("Janet", score);
	Person p7("Mars", score);
	Person p8("Tony", score);
	Person p9("Ailsa", score);
	Person p10("Carry", score);
	Person p11("Kris", score);
	Person p12("Eva", score);
	Person p13("Joan", score);
	Person p14("Gina", score);
	Person p15("Joy", score);
	Person p16("Demi", score);
	Person p17("Manda", score);
	Person p18("Rose", score);
	Person p19("Sunny", score);
	Person p20("Tina", score);

	vp.push_back(p1);
	vp.push_back(p2);
	vp.push_back(p3);
	vp.push_back(p4);
	vp.push_back(p5);
	vp.push_back(p6);
	vp.push_back(p7);
	vp.push_back(p8);
	vp.push_back(p9);
	vp.push_back(p10);
	vp.push_back(p11);
	vp.push_back(p12);
	vp.push_back(p13);
	vp.push_back(p14);
	vp.push_back(p15);
	vp.push_back(p16);
	vp.push_back(p17);
	vp.push_back(p18);
	vp.push_back(p19);
	vp.push_back(p20);
}
void setScore(vector<Person> &vp)
{
	for (vector<Person>::iterator i = vp.begin(); i != vp.end(); ++i)
	{
		deque<int> d;
		for (int i = 0; i < 10; ++i)
		{
			int score = rand() % 41 + 60;
			d.push_back(score);
		}
		sort(d.begin(), d.end());
		d.pop_back();
		d.pop_front();
		int sum = 0;
		cout<<i->name<<"score is :\t";
		for (deque<int>::iterator dit = d.begin(); dit != d.end(); ++dit)
		{
			sum += *dit;
			cout<<*dit<<"\t";
		}
		cout<<endl;
		int avg = sum / d.size();
		// give competitor
		i->score = avg;
	}
}
int main(int argc, char const *argv[])
{
	vector<Person> vp;
	createPerson(vp);
	setScore(vp);
	print(vp);
	return 0;
}